//引入react
import React from 'react'
//引入样式文件
import '../../asset/css/home/homePage.css'
//引入头部组件
import Header from './header'
//引入导航组件
import Kind from './kindNav'
//引入banner组件
import Banner from './banner'
//引入lunbo组件
import Lunbo from './lunbo'
//引入MerchantStore组件
import MerchantStore from './merchantStore'
//引入storeList组件
import StoreList from './storeList'
//引入flyBall组件
import FlyBall from './flyBall'
//创建组件

class HomePage extends React.Component {
    constructor() {
        super()
        this.homeBox = React.createRef()
        this.state = {
            //设置悬浮球隐藏于显示
            showFlyBall: false,
             
        }

    }

    //监听滚动
    componentDidMount(){
        window.addEventListener('scroll',this.handleScroll,true);
    }
    handleScroll=(event)=>{
       console.log(document.documentElement.scrollTop)
    }
    render() {
        this.handleScroll();
        return (
            <div className='home' ref={this.homeBox} >
            
                {/*头部组件*/}
                <Header  />
                {/*分类导航组件*/}
                <Kind />
                {/*banner组件*/}
                <Banner />
                {/*轮播组件*/}
                <Lunbo />
                {/*商家推荐组件*/}
                <MerchantStore />
                {/*商家导航组件*/}
                <StoreList />
                {/*悬浮球组件*/}
                <FlyBall show={this.state.showFlyBall} onWheel={this.handWheel} />
            </div>
        )
    }
}
//暴露出
export default HomePage